﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Ketquatimkiem.aspx.cs" Inherits="WebHousingInfo.Ketquatimkiem" %>
<%@ Register Src="~/Controls/Header.ascx" TagName="Head" TagPrefix="Header" %>
<%@ Register Src="~/Controls/MenuFooter.ascx" TagName="MeNuDuoi" TagPrefix="MenuFooter" %>
<%@ Register Src="~/Controls/Footer.ascx" TagName="Foot" TagPrefix="Footer" %>
<%@ Register Src="~/Controls/QuangCaoTren.ascx" TagName="QCT" TagPrefix="QuangCaoTren" %>
<%@ Register Src="~/Controls/DanhMucNhaChoThue.ascx" TagName="CT" TagPrefix="DanhMucNhaChoThue" %>
<%@ Register Src="~/Controls/TinTucTieuDiem.ascx" TagName="TTTD" TagPrefix="TinTucTieuDiem" %>
<%@ Register Src="~/Controls/KhongGianSong.ascx" TagName="KGS" TagPrefix="KhongGianSong" %>
<%@ Register Src="~/Controls/TimKiemTrangCon2.ascx" TagName="TK2" TagPrefix="TimKiem2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Kết quả tìm kiếm</title>
</head>
<body>
    <form id="form1" runat="server">
        <div id="uni_wrapper">
        <Header:Head ID="Header" runat="server" />
            <div id="uni_main">
             <!-- E_Header Navigation Menu -->                 
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>                
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>                
	            <div id="content" class="clearfix">
		            <div id="group_750_l">
			            <div id="banner">
				            <div class="banner_ad_left">
				                <a href="HuongDanDangTin.aspx"><img src="Images/image_dd.png" width="465px" height="175px" border="2" style="border:1px solid Gray" align="left" /></a>
				            </div>				           
			            </div>				            
				        <TimKiem2:TK2 ID="TK2" runat="server" />			            
			            <div id="ketquatimkiem" class="clearfix">
				            <div class="title_ketquatimkiem">
					            <p style="text-transform:uppercase">
						            Kết quả tìm kiếm
					            </p>
				            </div>
				            <% var obNewstin = getdatasource();
                               string query = null;
                               int page = 1;
                               query = Request.QueryString["page"];
                               if (query != null) { page = int.Parse(query); }    %>
				            <div class="content">
					            <div id="show01">Kết quả : <%=page*10-10 %> - <% if (page * 10 <= gettotalpage())
                                                                  { %><%=page * 10%><%}
                                                                  else
                                                                  { %><%=gettotalpage()%><%} %> trong số <%=gettotalpage()%> tin</div>
					            <div id="show02">Sắp xếp theo:
						            <select name="sapxep" class="input" style="width:122px">
							            <option value="0" selected >Ngày đăng mới nhất</option>
							            <option value="1" none >Giá thấp đến cao</option>
							            <option value="2" none >Giá cao đến thấp</option>
						            </select>
					            </div>
				            </div>
			            </div>
		              <!-- e ket qua tim kiem-->
		              <%if (obNewstin != null)
                  {
                      if (obNewstin.Count > 0)
                      { %>
			             <div id="menu_timkiem">	
				            <div class="bg">
					            <ul>
						            <li style="width:100px;">Hình ảnh</li>
						            <li style="width:168px;">Thông Tin</li>
						            <li class="right" style="width:98px;">Ngày Đăng</li>
						            <li class="right" style="width:87px;">Nơi Đăng</li>
					            </ul>
				            </div> 
			             </div>
			             <%}
                  } %> 
			            <%
                  if (obNewstin != null)
                  {
                      int cout = 0;
                      foreach (var obNewsHouse in obNewstin)
                      {
                          cout += 1;
                             %>
                            <div id="data_group_width_748">
                            <%if (cout < obNewstin.Count)
                              { %>
			                    <div class="sub_data_group_width_748">
			                <%}
                              else
                              { %>
			                    <div class="sub_data_group_width_748" style="margin-bottom:0px;">
			                <%} %>
				                    <div class="img_width_100">
				                    <% if (obNewsHouse.UrlImage != "")
                        {
                            var listimage = obNewsHouse.UrlImage.Split('/');
                            string url = "";
                            foreach (var detail in listimage)
                            {
                                if (checkurlimage(detail) == true)
                                {
                                    url = "TotalUpload/ImagesTotal/" + detail;                                    
                                                        
                                                    
                                                 %><a href="TinNhaDatChiTiet.aspx?id=<%=obNewsHouse.NewsHouseID %>"><img src="<%=url %>" width="100px" height="100px" border="0" align="left" /></a><% break;
                                }
                            }
                            if (url == "")
                            { %><a href="TinNhaDatChiTiet.aspx?id=<%=obNewsHouse.NewsHouseID %>"><img src="TotalUpload/ImagesTotal/noimage.gif" width="100px" height="100px" border="0" align="left" /></a>
                                        <% }
                        }
                        else
                        { %>
                                        <a href="TinNhaDatChiTiet.aspx?id=<%=obNewsHouse.NewsHouseID %>"><img src="TotalUpload/ImagesTotal/noimage.gif" width="100px" height="100px" border="0" align="left" /></a>
                                    <%} %></div>
				                    <div class="right_width_647">
					                    <div class="title_group_width_647">
						                    <span class="sub_title_left"><a href="TinNhaDatChiTiet.aspx?id=<%=obNewsHouse.NewsHouseID %>"><%=obNewsHouse.Title%></a></span>
						                    <span class="sub_title_right"><a href="TinNhaDatChiTiet.aspx?id=<%=obNewsHouse.NewsHouseID %>">chi tiết</a></span>
					                    </div>
					                    <div class="content_group_width_647">
						                    <table width="647" border="0" cellspacing="0" cellpadding="0">						
							                    <tr>
								                    <td valign="top" class="li_width_126" width="120"  bgcolor="#FFFFFF">
									                    <div class="li_width_126_01">
										                    Giá: <span class="spannormal"><%=obNewsHouse.Price%> <%=obNewsHouse.CurrencyName%></span><br>DT: <% if (obNewsHouse.SurfaceAreaHeight == obNewsHouse.SurfaceAreaWidth)
                                                                                                                               { %><%=obNewsHouse.SurfaceAreaWidth%> m<sup>2</sup> <%} %> <%else
                        { %><%=obNewsHouse.SurfaceAreaWidth%> x <%=obNewsHouse.SurfaceAreaHeight%> (m x m)<%} %> <br />Vị trí: <%=obNewsHouse.AreaDetailName%><br>	
									                    </div>
								                    </td>
								                    <td valign="top" bgcolor="#FFFFFF" class="li_width_336">
									                    <div class="li_width_336_01" align="justify">
										                    <% if (obNewsHouse.NewsContent.Length > 200)
                              {%>
                                                            <%=obNewsHouse.NewsContent.Substring(0, 199)%> ...
                                                        <%}
                              else
                              {%>
                                                         <%=obNewsHouse.NewsContent%>
                                                        <%} %><br />
										                    <span class="spannormal">Lượt xem: <b><%=obNewsHouse.ViewCount%></b>  |  								
											                    <span>
												                    <a href="Ketquatimkiem.aspx?save=<%=obNewsHouse.NewsHouseID %>">Lưu tin</a>
											                    </span>
										                    </span>
									                    </div>
								                    </td>
								                    <td valign="top" bgcolor="#FFFFFF" class="li_width_88">
									                    <div class="li_width_88_01">
									                        <%=obNewsHouse.AreaDetailName%><br />
											                <%=obNewsHouse.AreaName%><br />Đà Nẵng			
									                     </div>
								                    </td>
								                    <td valign="top" class="li_width_97">
									                    <div class="li_width_97_01">
									                        <%=obNewsHouse.CreatedDate.ToShortDateString()%>
									                    </div>
								                    </td>
							                    </tr>
						                    </table>																	
					                    </div>
				                    </div>
			                    </div>					                    																
		                    </div>
                            <%                            
                      }%>
                      <%if(obNewstin.Count > 0){ %>
                        <div id="link">
			                <asp:Label ID="lblpaging" runat="server" Text=""></asp:Label>
		                </div>
		                <%} %>
                  <%}%>  			            
		            </div>
		            <div id="group_5">
		                
			            <DanhMucNhaChoThue:CT ID="DanhMucNhaChoThue" runat="server" />
			            <TinTucTieuDiem:TTTD ID="TinTucTieuDiem" runat="server" />
			            <KhongGianSong:KGS ID="KhongGianSong" runat="server" />
		            </div>
	            <!--E_menu-->
	            </div>	
            </div>
            </ContentTemplate>
            </asp:UpdatePanel>
            <MenuFooter:MeNuDuoi ID="MenuFooter" runat="server" />
            <Footer:Foot ID="Footer" runat="server" />
         </div>
    </form>
</body>
</html>
